Skip to content
main
Switch branches/tags
jam0001/fnord/
jam0001/fnord/

Latest commit

* initial development of data structures

* comment and field access

* start on parser

* finish parsing except comments

* script parser

* little parser fixes

* remove infinite loop from parser

* comment raw access

* parse unit

* finish fixing parser tests

* parse comments

* fix field comment downflow

* override field comments

* override struct comments

* hide debug output

* make result output display nice

* result print newlines

* address warnings

* cli

* some example files

* add

* readme

* examples

* fix empty comment display

* move examples to top level

* improve example

* more examples

* update units example to display result
ba75fc4

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
Aug 20, 2021

comment-record

a silly little language

  • building it
  • using it
  • writing it
  • extending it

building it

cr is built with Rust. once you have Rust installed, navigate to the comment-record directory and run:

cargo build

this puts the executable in the target/debug directory. You can also just run it directly with:

cargo run

using it

write some code in a file, save it as (e.g.) test.cr and then run:

cargo run test.cr

if the last statement of the file is a value, it is printed.

writing it

cr allows two statement types: a type definition and a value definition. cr has a simple data model, with numbers, text, structs, and comment types.

# this is a comment

# this is a number
number = 42;

# this is text
text = "foobar";

# this is an anonymous struct
object = {
	name: "My Great Object",
	age: 42,
};

comments can be attached to struct & field types and instances. they flow down from types to instances.

# struct definition
struct MyStruct {
	# field definition
	my_field: Number,
};

# struct instance
value = MyStruct {
	# field instance
	my_field: 42,
};

comments can be incorporated by reference.

# Here is a lengthy comment describing some important things
# that we might want to share among several items.
parent = {};

#! parent
child = {};

comments can be inspected at run time, which we use to implement an idiomatic version of hello world.

# hello, world!
x = {};

result = x!!;

any fields listed in the comments are extracted for use.

# NAME: Bort
x = {};

result = "We need more " + x!NAME + " license plates in the gift shop.";

extending it

if we added procedures, it would open some interesting avenues to explore around how comments would flow alongside the data they are connected to.